<?php if(!defined("HDPHP_PATH"))exit;C("SHOW_NOTICE",FALSE);?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
        <head>
                <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
                <title></title>
                <link rel="stylesheet" href="http://localhost/shopFrame/Application/Admin/View/Public/Css/bootstrap.min.css" />
                <link rel="stylesheet" href="http://localhost/shopFrame/Application/Admin/View/Public/Css/common.css" />
                <script type='text/javascript' src='http://localhost/shopFrame/hdphp/Extend/Org/Jquery/jquery-1.8.2.min.js'></script>

                <script type="text/javascript" src='http://localhost/shopFrame/Application/Admin/View/Public/Js/goods.js'></script>
                <script type="text/javascript">
                        $(function() {
                                $('select[name=type_tid]').change(function() {
                                         var oVal = $(this).val();
                                        $.ajax({
                                                url: 'http://localhost/shopFrame/index.php/Admin' + '&m=Admin&c=TypeAttr&a=ajax_attr',
                                                data: {tid: oVal},
                                                dataType: 'json',
                                                type: 'post',
                                                success:function(data){
                                                        if(data){
                                                                $('#spec tr.info td').html('该类型下暂时没有添加商品规格或者您还没有选择类型！');
                                                                $('#attr tr.info td').html('该类型下暂时没有添加商品属性或者您还没有选择类型！')
                                                                $.each(data,function(k,v){
                                                                                        if(v.class==1){
                                                                                                if($('#spec tr.info td').html()=='该类型下暂时没有添加商品规格或者您还没有选择类型！'){
                                                                                                        $('#spec tr.info td').html('');
                                                                                                }
                                                                                                oRadio='<dl style="padding-left:10px;float:left;padding-bottom:10px;"><dt style="padding-left:10px;padding-bottom:10px;padding-top:10px;font-size:16px;">'+v.taname+'</dt>';
                                                                                                var tempArr =new Array();
                                                                                                tempArr = v.tavalue.split(',');
                                                                                                for(i=0;i<tempArr.length;i++){
                                                                                                        oRadio+='<dd style="float:left;width:300px;padding-right:15px;"><label style="float:left;"><input type="checkbox" class="standard" name="standard_'+v.taid+'['+i+']" style="float:left;margin-right:10px;" value="'+tempArr[i]+'">'+'<p style="float:right">'+tempArr[i]+'</p></label><input type="text" style="float:right;width:170px;" placeholder="附加价格,不需要可以不填" name="standard_'+v.taid+'_'+i+'_added"></dd>';
                                                                                                }
                                                                                                oRadio+='</dl>';
                                                                                                $('#spec tr.info td').append(oRadio);
                                                                                        }
                                                                                        if(v.class==0){
                                                                                                if($('#attr tr.info td').html()=='该类型下暂时没有添加商品属性或者您还没有选择类型！'){
                                                                                                        $('#attr tr.info td').html('');
                                                                                                }
                                                                                                oSelect='<select name="attr_'+v.taid+'" style="margin:10px;">';
                                                                                                var tempArr2 =new Array();
                                                                                                tempArr2 = v.tavalue.split(',');
                                                                                                for(i=0;i<tempArr2.length;i++){
                                                                                                        oSelect+= '<option value="'+tempArr2[i]+'">'+tempArr2[i]+'</option>';
                                                                                                }
                                                                                                oSelect+='</select>附加价格 : &nbsp;<input type="text" placeholder="附加价格，不需要可以不填" style="margin:0px;" name="attr_'+v.taid+'_added"><br/>';
                                                                                                $('#attr tr.info td').append(oSelect);
                                                                                        }
                                                                        })
                                                                  }
                                                           }
                                                 })
                                        $.ajax({
                                                url: 'http://localhost/shopFrame/index.php/Admin' + '&m=Admin&c=Category&a=ajax_cate',
                                                data: {tid: oVal},
                                                dataType: 'json',
                                                type: 'post',
                                                success: function(data) {
                                                        var option = '<option value="0">-----------请选择-----------</option>';
                                                        if (data) {
                                                                $.each(data, function(k, v) {
                                                                        if(v.pid!=0){
                                                                                option += '<option value=' + v.cid +'>' + v._name + '</option>';
                                                                        }else{
                                                                                option += '<option value=' + v.cid + ' disabled="disabled">' + v._name + '</option>';
                                                                        }
                                                                })
                                                        }
                                                        $('select[name=cid]').html('');
                                                        $('select[name=cid]').append(option);
                                                }
                                        })
                                        $.ajax({
                                                url: 'http://localhost/shopFrame/index.php/Admin' + '&m=Admin&c=Brand&a=ajax_brand',
                                                data: {tid: oVal},
                                                dataType: 'json',
                                                type: 'post',
                                                success: function(data) {
                                                        var option = '<option value="0">-----------请选择-----------</option>';
                                                        if (data) {
                                                                $.each(data, function(k, v) {
                                                                                option += '<option value=' + v.bid +'>' + v.bname + '</option>';     
                                                                })
                                                        }
                                                        $('select[name=bid]').html('');
                                                        $('select[name=bid]').append(option);
                                                }
                                        })
                                })
                        })
                </script>
        </head>
        <body>
                <div class="container-fluid">
                        <div class="row-fluid">
                                <div class="span12">
                                        <form action="" method='post'>
                                                <fieldset>
                                                        <legend>添加商品</legend>
                                                        <table class='table table-bordered table-hover'>
                                                                <thead>
                                                                        <tr>
                                                                                <th colspan="2" class="btn btn-primary">基本信息</th>
                                                                        </tr>
                                                                </thead>
                                                                <tbody>
                                                                        <tr class="info">
                                                                                <td>所属类型</td>
                                                                                <td>
                                                                                        <select name="type_tid">
                                                                                                <option value="0">-----------请选择-----------</option>
                                                                                                <?php if(is_array($typeInfo)){?><?php  foreach($typeInfo as $key=>$v){ ?>
                                                                                                        <option value="<?php echo $v['tid'];?>"><?php echo $v['tname'];?></option>
                                                                                                <?php }}?>
                                                                                        </select>
                                                                                        <span class='help-inline help'>----------注:所属类型,分类,品牌请先手动添加再选择----------</span>
                                                                                </td>
                                                                        </tr>
                                                                        <tr class="info">
                                                                                <td>所属分类</td>
                                                                                <td>
                                                                                        <select name="cid">
                                                                                                <option value="0">-----------请选择------------</option>
                                                                                        </select>
                                                                                        <span class='help-inline help'>----------注:请先选择所属类型,顶级分类不能添加商品----------</span>
                                                                                </td>
                                                                        </tr>
                                                                        <tr class="info">
                                                                                <td>所属品牌</td>
                                                                                <td>
                                                                                        <select name="bid">
                                                                                                <option value="0">-----------请选择-----------</option>
                                                                                                <?php if(is_array($brandInfo)){?><?php  foreach($brandInfo as $key=>$v){ ?>
                                                                                                        <option value="<?php echo $v['bid'];?>"><?php echo $v['bname'];?></option>
                                                                                                <?php }}?>
                                                                                        </select>
                                                                                </td>
                                                                        </tr>
                                                                        <tr class="info">
                                                                                <td>商品名称</td>
                                                                                <td>
                                                                                        <input type="text" name='gname'/>
                                                                                        <span class='help-inline help'>----------注:商品标题最多45个字符----------</span>
                                                                                </td>
                                                                        </tr>
                                                                        <tr class="info">
                                                                                <td>商品次标题</td>
                                                                                <td>
                                                                                        <input type="text" name='lhname'/>
                                                                                </td>
                                                                        </tr>
                                                                        <tr class="info">
                                                                                <td>单位</td>
                                                                                <td>
                                                                                        <input type="text" name='unit' value='件'/>
                                                                                </td>
                                                                        </tr>
                                                                        <tr class="info">
                                                                                <td>市价场</td>
                                                                                <td>
                                                                                        <input type="text" name='mprice'/>
                                                                                        <span class='help-inline help'>----------注:价格为敏感区域，请谨慎填写----------</span>
                                                                                </td>
                                                                        </tr>
                                                                        <tr class="info">
                                                                                <td>京东价</td>
                                                                                <td>
                                                                                        <input type="text" name='jdprice'/>
                                                                                        <span class='help-inline help'>----------注:价格为敏感区域，请谨慎填写----------</span>
                                                                                </td>
                                                                        </tr>
                                                                        <tr class="info">
                                                                                <td>点击次数</td>
                                                                                <td>
                                                                                        <input type="text" name='click'/>
                                                                                </td>
                                                                        </tr>
                                                                         <tr class="info">
                                                                                <td>商品库存</td>
                                                                                <td>
                                                                                        <input type="text" name='stock'/>
                                                                                </td>
                                                                        </tr>
                                                                </tbody>
                                                        </table>

                                                        <p class="btn btn-primary">商品属性</p>
                                                        <table class="table table-bordered table-hover" id='attr' class="info">
                                                                <tr class="info"><td>该类型下暂时没有添加商品属性或者您还没有选择类型！</td></tr>
                                                        </table>
                                                        <p class="btn btn-primary">商品规格</p>
                                                        <table class="table table-bordered table-hover" id='spec'>
                                                                <tr class="info"><td>该类型下暂时没有添加商品规格或者您还没有选择类型！</td></tr>
                                                        </table>

                                                        <table class='table table-bordered'>
                                                                <tr>
                                                                        <th colspan="2" class="btn btn-primary">列表图</th>
                                                                </tr>
                                                                <tr class="info">
                                                                        <td>上传图片</td>
                                                                        <td>
                                                                                <link rel="stylesheet" type="text/css" href="http://localhost/shopFrame/hdphp/Extend/Org/Uploadify/uploadify.css" />
            <script type="text/javascript" src="http://localhost/shopFrame/hdphp/Extend/Org/Uploadify/jquery.uploadify.min.js"></script>
            <script type="text/javascript">
            var HDPHP_CONTROL         = "http://localhost/shopFrame/index.php?m=Admin&c=Goods&a=hd_uploadify";
            var UPLOADIFY_URL    = "http://localhost/shopFrame/hdphp/Extend/Org/Uploadify/";
            var HDPHP_UPLOAD_THUMB    ="";
HDPHP_UPLOAD_TOTAL = 0</script>
            <script type="text/javascript" src="http://localhost/shopFrame/hdphp/Extend/Org/Uploadify/hd_uploadify.js"></script>
<script type="text/javascript">
    $(function() {
        hd_uploadify_options.removeTimeout  =0;//提示框消息时间
        hd_uploadify_options.fileSizeLimit  ="1MB";
        hd_uploadify_options.fileTypeExts   ="*.gif;*.jpg;*.png;*.jpeg";
        hd_uploadify_options.showalt        =0;
        hd_uploadify_options.uploadLimit    =1;
        hd_uploadify_options.input_type    ="input";
        hd_uploadify_options.elem_id    ="";
        hd_uploadify_options.success_msg    ="正在上传...";//上传成功提示文字
        hd_uploadify_options.formData ={type:"*.gif;*.jpg;*.png;*.jpeg",water : "1",fileSizeLimit:1048576, someOtherKey:1,PHPSESSID:"bi3h12h1ucbbavfh74r4evjoj4",upload_dir:"upload/listimg/",hdphp_upload_thumb:""};
        hd_uploadify_options.thumb_width =80;
        hd_uploadify_options.thumb_height          =40;
        hd_uploadify_options.uploadsSuccessNums = 0;
        $("#hd_uploadify_listimg").uploadify(hd_uploadify_options);
        });
</script>
<input type="file" name="up" id="hd_uploadify_listimg"/><div class="hd_uploadify_listimg_msg num_upload_msg"><span></span>单文件最大<strong>1MB，允许上传类型*.gif;*.jpg;*.png;*.jpeg</strong></div><div id="hd_uploadify_listimg_queue"></div>
        <div class="hd_uploadify_listimg_files uploadify_upload_files" input_file_id ="hd_uploadify_listimg">
            <ul></ul>
            <div style="clear:both;"></div>
        </div>
                                                                        </td>
                                                                </tr>
                                                        </table>

                                                        <table class='table table-bordered'>
                                                                <tr>
                                                                        <th colspan="2" class="btn btn-primary">商品图</th>
                                                                </tr>
                                                                <tr class="info">
                                                                        <td>上传图片</td>
                                                                        <td>
                                                                                
<script type="text/javascript">
    $(function() {
        hd_uploadify_options.removeTimeout  =0;//提示框消息时间
        hd_uploadify_options.fileSizeLimit  ="1MB";
        hd_uploadify_options.fileTypeExts   ="*.gif;*.jpg;*.png;*.jpeg";
        hd_uploadify_options.showalt        =0;
        hd_uploadify_options.uploadLimit    =10;
        hd_uploadify_options.input_type    ="input";
        hd_uploadify_options.elem_id    ="";
        hd_uploadify_options.success_msg    ="正在上传...";//上传成功提示文字
        hd_uploadify_options.formData ={type:"*.gif;*.jpg;*.png;*.jpeg",water : "1",fileSizeLimit:1048576, someOtherKey:1,PHPSESSID:"bi3h12h1ucbbavfh74r4evjoj4",upload_dir:"upload/goodimg/",hdphp_upload_thumb:""};
        hd_uploadify_options.thumb_width =80;
        hd_uploadify_options.thumb_height          =50;
        hd_uploadify_options.uploadsSuccessNums = 0;
        $("#hd_uploadify_thumb").uploadify(hd_uploadify_options);
        });
</script>
<input type="file" name="up" id="hd_uploadify_thumb"/><div class="hd_uploadify_thumb_msg num_upload_msg"><span></span>单文件最大<strong>1MB，允许上传类型*.gif;*.jpg;*.png;*.jpeg</strong></div><div id="hd_uploadify_thumb_queue"></div>
        <div class="hd_uploadify_thumb_files uploadify_upload_files" input_file_id ="hd_uploadify_thumb">
            <ul></ul>
            <div style="clear:both;"></div>
        </div>
                                                                        </td>
                                                                </tr>
                                                        </table>

                                                        <table class='table'>
                                                                <tr class="next_show">
                                                                        <th class="btn btn-primary">商品详细<i class='ico'></i></th>
                                                                </tr>
                                                                <tr class="info hide">
                                                                        <td>
                                                                                <script type="text/javascript" charset="utf-8" src="http://localhost/shopFrame/hdphp/Extend/Org/Ueditor/ueditor.config.js"></script><script type="text/javascript" charset="utf-8" src="http://localhost/shopFrame/hdphp/Extend/Org/Ueditor/ueditor.all.min.js"></script><script type="text/javascript">UEDITOR_HOME_URL="http://localhost/shopFrame/hdphp/Extend/Org/Ueditor/"</script><script id="hd_detailCon" name="detailCon" type="text/plain"></script>
        <script type='text/javascript'>
        $(function(){
                var ue = UE.getEditor('hd_detailCon',{
                serverUrl:'http://localhost/shopFrame/index.php?m=Admin&c=Goods&a=ueditor_upload&water='//图片上传脚本
                ,zIndex : 1000
                ,initialFrameWidth:"100%" //宽度1000
                ,catchRemoteImageEnable:false//关闭远程图片自动保存到本地
                ,initialFrameHeight:"300" //宽度1000
                ,imagePath:''//图片修正地址
                ,autoHeightEnabled:false //是否自动长高,默认true
                ,autoFloatEnabled:false //是否保持toolbar的位置不动,默认true
                ,toolbars:[
            ['fullscreen', 'source', '|', 'undo', 'redo', '|',
            'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat', 'formatmatch', 'autotypeset',
            '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', '|',
            'lineheight', '|','paragraph', 'fontfamily', 'fontsize', '|',
             'indent','justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
            'link', 'unlink', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
            'insertimage', 'emotion',   'map',  'insertcode',  'pagebreak','horizontal', '|',
            'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow',  'insertcol',  'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols']
            ]//工具按钮
                ,enableAutoSave: false//关闭自动保存
                ,initialStyle:'p{line-height:1em; font-size: 14px; }'
            });
        })
        </script>
                                                                        </td>
                                                                </tr>
                                                        </table>

                                                        <table class='table'>
                                                                <tr class="next_show">
                                                                        <th class="btn btn-primary">售后服务<i class='ico'></i></th>
                                                                </tr>
                                                                <tr class="info hide">
                                                                        <td>
                                                                                <script id="hd_service" name="service" type="text/plain"></script>
        <script type='text/javascript'>
        $(function(){
                var ue = UE.getEditor('hd_service',{
                serverUrl:'http://localhost/shopFrame/index.php?m=Admin&c=Goods&a=ueditor_upload&water='//图片上传脚本
                ,zIndex : 1000
                ,initialFrameWidth:"100%" //宽度1000
                ,catchRemoteImageEnable:false//关闭远程图片自动保存到本地
                ,initialFrameHeight:"300" //宽度1000
                ,imagePath:''//图片修正地址
                ,autoHeightEnabled:false //是否自动长高,默认true
                ,autoFloatEnabled:false //是否保持toolbar的位置不动,默认true
                ,toolbars:[
            ['fullscreen', 'source', '|', 'undo', 'redo', '|',
            'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat', 'formatmatch', 'autotypeset',
            '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', '|',
            'lineheight', '|','paragraph', 'fontfamily', 'fontsize', '|',
             'indent','justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
            'link', 'unlink', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
            'insertimage', 'emotion',   'map',  'insertcode',  'pagebreak','horizontal', '|',
            'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow',  'insertcol',  'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols']
            ]//工具按钮
                ,enableAutoSave: false//关闭自动保存
                ,initialStyle:'p{line-height:1em; font-size: 14px; }'
            });
        })
        </script>
                                                                        </td>
                                                                </tr>
                                                        </table>
                                                        <div><input type="submit" value="确认添加" class="btn btn-primary btn-lg btn-block" /><br/><br/><br/><br/></div>
                                                </fieldset>
                                        </form>

                                </div>
                        </div>
                </div>
        </body>
</html>